#!/bin/bash
wd=$(pwd | sed -r -e 's_^.+/__')
for f in *.gabc
do
	of=$(echo $f | sed -e 's/\.gabc$/.txt/' -e "s_^_$HOME/editor/library/texts/${wd}/_")
	echo $f
	echo $of
	echo ""
	cat "$f" | sed -r -e '1,/^%%$/ d' -e 's/[{}]//g' -e 's/^\([^)]*\)//g' -e 's/\([^)]*\)\B/ /g' -e 's/\([^)]*\)+\b/+/g' -e 's/-\+/+/g' -e 's/\s+/ /g' -e 's/\s+$//g' -e '/^\s*$/ d' >"$of"
done
